<?php
// +----------------------------------------------------------------------
// | ManniuCMS
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2016 http://manniuyun.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: heitao <cms@manniuyun.com>
// +----------------------------------------------------------------------

namespace app\book\validate;

use think\Validate;

class Book extends Validate{

    protected $rule = [
        'catid'     => ['require','token'],
        'name' 		=> ['require'],
        'author' 	=> ['require'],
        'intro' 	=> ['require'],
        'cover'     => ['require'],
        'volumes'   => ['require'],
        'isvip'     => ['require','number','in'=>'0,1'],
        'full_flag' => ['require','number','in'=>'0,1'],
        'status'    => ['require','number','in'=>'0,1']
    ];

    protected $message  = [
        'catid.require'     => '栏目必选',

        'name.require'      => '图书名称不能为空',

        'author.require'    => '图书作者不能为空',

        'intro.require'     => '图书简介不能为空',

        'cover.require'     => '图书封面不能为空',

        'volumes.require'   => '图书分卷不能为空',

        'isvip.require'     => '是否VIP标识必选',
        'isvip.number'      => '是否VIP标识必须为数字',
        'isvip.in'          => '是否VIP标识的值必是0或1',

        'full_flag.require' => '是否全本标识必选',
        'full_flag.number'  => '是否全本标识必须为数字',
        'full_flag.in'      => '是否全本标识的值必是0或1',
        
        'status.require'    => '状态标识必选',
        'status.number'     => '状态标识必须为数字',
        'status.in'         => '状态标识的值必是0或1'
    ];
}